package com.uzhie.spring;

import org.apache.log4j.Logger;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.WebApplicationContext;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;

/**
 * Created by TangFei on 2018/8/7.
 */
public class HttpContextLoaderListener extends ContextLoaderListener {

    private Logger logger = Logger.getLogger(getClass());

    @Override
    public WebApplicationContext initWebApplicationContext(ServletContext servletContext) {
        logger.info("enter method initWebApplicationContext");
        return super.initWebApplicationContext(servletContext);
    }

    @Override
    public void contextInitialized(ServletContextEvent event) {
        logger.info("enter method contextInitialized");
        super.contextInitialized(event);
    }

    @Override
    public void closeWebApplicationContext(ServletContext servletContext) {
        logger.info("enter method closeWebApplicationContext");
        super.closeWebApplicationContext(servletContext);
    }
}
